<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:replace="userCommon::common-header"></head>
<body class="sb-nav-fixed">
<nav th:replace="userCommon::common-navbar"></nav>
<div id="layoutSidenav">
    <div th:replace="userCommon::common-sidenav"></div>

    <div id="layoutSidenav_content">
   该项目由杨骅麟 温小棋 尽心呈现
<main>
    <div class="container-fluid px-4">
        <h1 class="mt-4">My Courses</h1>

        <ol class="breadcrumb mb-4">
            <li class="breadcrumb-item"><a th:href="@{/toUserMain}">Home</a></li>
            <li class="breadcrumb-item active">My Courses</li>
        </ol>

        <div class="card mb-4">
            <div class="card-header">
                <i class="fas fa-table me-1"></i>
                Course Information Table
            </div>
            <div class="card-body">
                <table id="datatablesSimple">
                    <thead>
                        <tr>
                            <th>Number</th>
                            <th>Name</th>
                            <th>Time</th>
                            <th>Coach</th>
                            <th>Action</th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr th:each="class:${classOrderList}">
                            <td th:text="${class.classId}">Number</td>
                            <td th:text="${class.className}">Name</td>
                            <td th:text="${class.classBegin}">Time</td>
                            <td th:text="${class.coach}">Coach</td>
                            <td>
                                <a th:href="@{/user/delUserClass(classOrderId=${class.classOrderId})}"
                                    style="text-decoration: none">
                                    <input type="button" class="btn btn-sm btn-outline-danger" onclick="return del()"
                                        value="Drop Course">
                                </a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</main>

        <footer th:replace="userCommon::common-footer"></footer>
    </div>
</div>

<div th:include="userCommon::common-scripts"></div>
<script>
    function del() {
        let msg = "Are you sure you want to drop the class?";
        if (confirm(msg) == true) {
            return true;
        } else {
            return false;
        }
    }
</script>
</body>
</html>
